package com.gk.panda.apis.dahua.dahuasdk.demo.frame.vto;


import com.gk.panda.apis.dahua.dahuasdk.lib.NetSDKLib.LLong;
import com.gk.panda.apis.dahua.dahuasdk.lib.NetSDKLib.fDisConnect;
import com.gk.panda.apis.dahua.service.SCADADemoHD;
import com.sun.jna.Pointer;
import lombok.extern.slf4j.Slf4j;

/**
 * 设备断线回调函数，空实现。 建议回调函数使用单例模式
 * 
 * @author 47081
 *
 */
@Slf4j
public class DefaultDisConnect implements fDisConnect {
	private static DefaultDisConnect INSTANCE;

	private SCADADemoHD scadaDemoHD;

	public void setScadaDemoHD(SCADADemoHD scadaDemoHD){
		this.scadaDemoHD = scadaDemoHD;
	}

	private DefaultDisConnect() {
		// TODO Auto-generated constructor stub
	}

	public static DefaultDisConnect GetInstance() {
		if (INSTANCE == null) {
			INSTANCE = new DefaultDisConnect();
		}
		return INSTANCE;
	}

	@Override
	public void invoke(LLong lLoginID, String pchDVRIP, int nDVRPort, Pointer dwUser) {
		// TODO Auto-generated method stub
        log.info("lLoginID[%s] Device[%s] Port[%d] DisConnectCallBack!\n",lLoginID, pchDVRIP, nDVRPort);
		scadaDemoHD.disConnectRun(lLoginID);
	}
}
